package com.lxc.demos;

import com.bugsense.trace.BugSenseHandler;
import com.lxc.demos.util.Debug;

import android.app.Application;
import android.content.res.Configuration;
import android.util.Log;

/**
 * This is an example of a {@link android.app.Application} class.  Ordinarily you would use
 * a class like this as a central repository for information that might be shared between multiple
 * activities.
 * 
 * In this case, we have not defined any specific work for this Application.
 * 
 * See samples/ApiDemos/tests/src/com.example.android.apis/ApiDemosApplicationTests for an example
 * of how to perform unit tests on an Application object.
 * 
 *  @author Shineflag
 */
public class SampleApplication extends Application {
	
	public static SampleApplication instance = null;   //SampleApplication的全局引用
	/**日志的TAG*/
	public static final String TAG = "JUSTDEMOS";
	public static final String CATEGORY = "android.intent.category.LXC_CODE";
	


	/**
	 * Called when the application is starting, 
	 * before any other application objects have been created.
	 */
	@Override
	public void onCreate() {
		Log.d(TAG,"<--SampleApplication.onCreate-->");
		BugSenseHandler.setup(this, "89db05e8");
		Debug.threadInit();  //捕获Crash
		C2DMReceiver.refreshAppC2DMRegistrationState(this);
		instance = this;
		super.onCreate();
		instance = this;

	}

	/**
	 * This method is for use in emulated process environments.
	 */
	@Override
	public void onTerminate() {
		super.onTerminate();
		Log.d(TAG,"<--SampleApplication.onTerminate-->");
	}

	/**
	 * Called by the system when the device configuration changes while your component is running.
	 */
	@Override
	public void onConfigurationChanged(Configuration newConfig) {
		super.onConfigurationChanged(newConfig);
		Log.d(TAG,"<--SampleApplication.onConfigurationChanged-->");
	}

	/**
	 * This is called when the overall system is running low on memory, 
	 * and would like actively running process to try to tighten their belt.
	 */
	@Override
	public void onLowMemory() {
		super.onLowMemory();
		Log.d(TAG,"<--SampleApplication.onCreate-->");
	}
	
	

}
